<?php

namespace app\interfaces\model;

use app\interfaces\model\Shop as ShopModel;
use think\Request;
use think\Model;

class MemberOrder extends Model
{
//    public function getShopTitleAttr($value,$data)
//    {
//        return (new ShopModel())->where(['member_id'=>$data['shop_id']])->value('title');
//    }

    public function memberOrderAttached()
    {
        $information['id'] = ['gt', 0];

        return $this->hasMany('MemberOrderAttached', 'order_id', 'id')
            ->withField('goods_id,order_id,title,thumb_img,number,price as goods_price,attr,rebate_percentage,status as evaluate_status');
    }

    public function shop()
    {
        return $this->hasOne('Shop','member_id','shop_id')->withField('member_id,title');
    }
}
